<?php include('./include/db.class.php');?>
<?php
$username = $_POST['username'];
$password = md5($_POST['password']);
//echo $password;
if($username && $password){
	$sql = 'select * from vv_members where vv_name="'.$username.'" and vv_password="'.$password.'"';
	$result = $DB->query($sql);
	$has = $DB->affected_rows();
	$array = $DB->get_rows_array();
	$vv_id = $array[0]['vv_id'];
	//echo $vv_id;
	//die();
	if($has){
		session_start();
		$_SESSION['login_status'] = $username;
		$_SESSION['login_id'] = $vv_id;
		header('Location:./im.php');
	}else{
		header('Location:./login.html?flag=error');
	}
}
?>
